package com.andaily.web.controller.mobile.thing;

import com.andaily.domain.dto.thing.ThingStatisticsDto;
import com.andaily.service.ThingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Shengzhao Li
 */
@Controller
@RequestMapping("/thing/chart")
public class ThingChartController {

    @Autowired
    private ThingService thingService;

    @RequestMapping("status")
    public String status(Model model) {
        ThingStatisticsDto statusStatisticsDto = thingService.loadStatusStatisticsDto();
        model.addAttribute("statusStatisticsDto", statusStatisticsDto);
        return "thing/thing_status_chart";
    }

    @RequestMapping("priority")
    public String priority(Model model) {
        ThingStatisticsDto priorityStatisticsDto = thingService.loadPriorityStatisticsDto();
        model.addAttribute("priorityStatisticsDto", priorityStatisticsDto);
        return "thing/thing_priority_chart";
    }


}
